/*
 *  web_server_proxy.h
 *  mongoose
 *
 *  Created by xl on 11-4-24.
 *  Copyright 2011 Justin Lee. All rights reserved.
 *
 */

#ifndef __HTTP_SERVER_PROXY_H__
#define __HTTP_SERVER_PROXY_H__

#ifdef __cplusplus
extern "C" {
#endif
	
typedef enum e_WEB_SERVER_REQUEST_METHOD
{
	WS_RM_GET = 0,
	WS_RM_POST,
	WS_RM_PUT,
	WS_RM_DELETE,
	WS_RM_NUM,
} WEB_SERVER_REQUEST_METHOD;

typedef void* WEB_SERVER_HANDLE;
typedef void* WEB_SERVER_REQUEST_HANDLE;
typedef int (*WEB_SERVER_REQUEST_NOTIFY)(WEB_SERVER_REQUEST_HANDLE hr,long remote_ip,int remote_port,void* param);

WEB_SERVER_HANDLE web_server_start(char* web_dir, char* port);
void web_server_stop(WEB_SERVER_HANDLE handle);
	
	void web_server_set_request_callback_func(WEB_SERVER_REQUEST_METHOD method, char* url_sub_str, WEB_SERVER_REQUEST_NOTIFY call_back, void* param);

long long web_server_open_post_data(WEB_SERVER_REQUEST_HANDLE hr);
int web_server_get_post_data_file_name(WEB_SERVER_REQUEST_HANDLE hr, char* buf, int size);
long long web_server_read_post_data(WEB_SERVER_REQUEST_HANDLE hr, char* buf, int buf_size);
void web_server_close_post_data(WEB_SERVER_REQUEST_HANDLE hr);
	
int web_server_get_server_ip_idx(WEB_SERVER_HANDLE handle);
char* web_server_get_web_dir(WEB_SERVER_HANDLE handle);
char* web_server_get_port(WEB_SERVER_HANDLE handle);
char* web_server_get_local_url(WEB_SERVER_HANDLE handle);

int web_server_get_local_ip_address_count();
char* web_server_get_local_ip_address(int i);
	
int web_server_get_local_hardware_address_count();
char* web_server_get_local_hardware_address(int i);
    
void web_server_mg_set_redir_path(char* symbol, char* dir);

#ifdef __cplusplus
}
#endif

#endif